package net.hn.hnms.sys.system.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.hn.hnms.sys.common.mybatis.core.mapper.BaseMapperPlus;
import net.hn.hnms.sys.system.api.domain.SysUser;
import net.hn.hnms.sys.system.domain.SysNotice;
import net.hn.hnms.sys.system.vo.SysNoticeVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 通知公告表 数据层
 *
 * @author Lion Li
 */
public interface SysNoticeMapper extends BaseMapperPlus<SysNoticeMapper, SysNotice, SysNotice> {
    List<SysNotice> getNoticeList(Long userId);


    @Select("SELECT\n" +
            "            sn.notice_id,sn.notice_title,sn.notice_type,sn.notice_content,sn.status,sn.create_by,sn.create_time,sn.update_by,sn.update_time,sn.remark\n" +
            "        FROM\n" +
            "            user_notice_status un\n" +
            "                LEFT JOIN\n" +
            "            sys_notice sn\n" +
            "            ON sn.notice_id = un.notice_id AND un.user_id =  ${userIds}\n" +
            "        WHERE\n" +
            "            1=1 and sn.status = '0' and un.status=${flag} ")
    IPage<SysNotice> selectPageNoticeListByUserId(Page<SysNotice> page, @Param("userIds") Long userIds,@Param("flag") String flag);


    SysNoticeVo selectByIdNoticeVo ();

}
